package com.aspose.cells;

class zawr extends zawp {
   private boolean j;
   private int k;
   private boolean l;
   private int m;
   private int n;

   public zawr(zahn[] var1, zagj var2, zaay var3) {
      super(var1, var2, var3);
      this.j = this.b[0].n();
      this.k = this.b[0].e();
      this.l = false;
   }

   public zawr(zahn[] var1, zagj var2, zaay var3, zagu var4) {
      super(var1, var2, var3);
      this.d = var4;
      this.j = this.b[0].n();
      this.k = this.b[0].e();
      this.l = false;
   }

   zawr(zawr var1, zaay var2) {
      super(var1.e(var2), (zagj)var1.c.a(var2), var2);
      this.d = var1.d;
      this.j = var1.j;
      this.k = var1.k;
      if (var1.l) {
         this.l = true;
         this.m = var1.m;
         this.n = var1.n;
      } else {
         this.l = false;
      }

   }

   public zahn b(zaay var1) {
      return new zawr(this, var1);
   }

   public boolean b(int var1, int var2) {
      return this.a(this.j ? var1 : var2);
   }

   public boolean a(int var1) {
      if (this.g < this.b.length && var1 == this.b[this.g].k()) {
         return true;
      } else {
         this.h = null;
         int var3 = this.k;
         this.g = 0;

         for(int var5 = 0; var5 < this.b.length; ++var5) {
            zahn var2 = this.b[var5];
            if (var2.a(var1)) {
               this.f[var5] = true;
               int var4 = var2.k() - var3;
               if (var4 > 0) {
                  this.e[var5] = false;
               } else {
                  this.e[var5] = true;
                  if (var4 < 0) {
                     var3 += var4;
                     if (this.g < var5) {
                        do {
                           this.e[this.g] = false;
                           ++this.g;
                        } while(this.g != var5);
                     }
                  }
               }
            } else {
               this.f[var5] = false;
               this.e[var5] = false;
               if (this.g == var5) {
                  ++this.g;
               }
            }
         }

         return this.g < this.b.length;
      }
   }

   public boolean g() {
      zahn var1;
      if (this.i > -1) {
         var1 = this.b[this.i];
         if (this.f[this.i]) {
            this.i = -1;
            return this.a(var1.k());
         } else {
            this.i = -1;
            return false;
         }
      } else {
         this.h = null;
         int var2 = this.k;
         this.g = 0;

         for(int var4 = 0; var4 < this.b.length; ++var4) {
            var1 = this.b[var4];
            int var3;
            if (this.e[var4]) {
               if (var1.g()) {
                  var3 = var1.k() - var2;
                  if (var3 > 0) {
                     this.e[var4] = false;
                  } else if (var3 < 0) {
                     var2 += var3;
                     if (this.g < var4) {
                        do {
                           this.e[this.g] = false;
                           ++this.g;
                        } while(this.g != var4);
                     }
                  }
               } else {
                  this.f[var4] = false;
                  this.e[var4] = false;
                  if (this.g == var4) {
                     ++this.g;
                  }
               }
            } else if (this.f[var4]) {
               var3 = var1.k() - var2;
               if (var3 == 0) {
                  this.e[var4] = true;
               } else if (var3 < 0) {
                  this.e[var4] = true;
                  var2 += var3;
                  if (this.g < var4) {
                     do {
                        this.e[this.g] = false;
                        ++this.g;
                     } while(this.g != var4);
                  }
               }
            } else if (this.g == var4) {
               ++this.g;
            }
         }

         return this.g < this.b.length;
      }
   }

   public zahn b(int var1) {
      return (zahn)(this.j ? new zaya(this.a(var1, 0)) : this);
   }

   public zahn c(int var1) {
      return (zahn)(this.j ? this : new zaya(this.a(0, var1)));
   }

   public zahn c(zaay var1) {
      if (!this.l) {
         this.C();
      }

      zbvk var2 = new zbvk(this, this.d, this.m, this.n, this.k, this.j);
      return new zawy(new zawr(this, var1), var2, var1);
   }

   public boolean m() {
      return !this.j;
   }

   public boolean n() {
      return this.j;
   }

   public int c() {
      return this.j ? this.k : 1;
   }

   public int d() {
      return this.j ? 1 : this.k;
   }

   public int e() {
      return this.k;
   }

   public boolean q() {
      return this.l;
   }

   public int r() {
      if (!this.j) {
         return 0;
      } else {
         if (!this.l) {
            this.C();
         }

         return this.m;
      }
   }

   public int s() {
      if (!this.j) {
         return 0;
      } else {
         if (!this.l) {
            this.C();
         }

         return this.n;
      }
   }

   public int t() {
      if (this.j) {
         return 0;
      } else {
         if (!this.l) {
            this.C();
         }

         return this.m;
      }
   }

   public int u() {
      if (this.j) {
         return 0;
      } else {
         if (!this.l) {
            this.C();
         }

         return this.n;
      }
   }

   public int v() {
      return this.m;
   }

   public int w() {
      return this.n;
   }

   private void C() {
      this.l = true;
      zahn var1 = this.b[0];
      this.m = var1.v();
      this.n = var1.w();

      for(int var2 = 1; var2 < this.b.length; ++var2) {
         var1 = this.b[var2];
         this.m = Math.min(this.m, var1.v());
         this.n = Math.max(this.n, var1.w());
      }

   }
}
